
let mqtt = require('mqtt')
let client = mqtt.connect('mqtt://192.168.2.33:1883', {username: 'test', password: 'test'})

let topic_sub = 'sublevel'
let topic_ro = 'rolevel'
let topic_temp = 'temperature'

let sublevel = '0'
let rolevel = '0'
let tanktemp = '0.00'

client.subscribe(topic_sub)
client.subscribe(topic_ro)
client.subscribe(topic_temp)

let tankInfoEvent

client.on('message', mqtt_message)

function mqtt_message(topic, message) {
    tankInfoEvent.send(topic.toString(), message.toString())
}

module.exports = function(eventSend) {
	tankInfoEvent = eventSend;
};

